import java.awt.Graphics;
import javax.swing.JPanel;

public class Figura2 extends JPanel {

    public void paintComponent( Graphics g)
    {
        super.paintComponent(g);
        
        int anchura = getWidth();
        int altura = getHeight();
        
        int i=0;
        
        while(i<=getWidth()){
            
            g.drawLine(0,0,i,altura);
            g.drawLine(getWidth(),getHeight(),i,altura);
            g.drawLine(getWidth(),0,anchura,altura);
            g.drawLine(0,getHeight(),anchura,altura);
            
            
            i+=10; 
            altura-=10;
            anchura-=10;
        }
        
        
       
    }
    
}
